<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel=StyleSheet HREF="../stylesheet/stylesheet.css" TYPE="text/css" MEDIA=screen>
<title>Shop Management System</title>
<?php include('menu.php'); ?>
</head>
<body>
<?php
if($_GET["action"]=="add") {
	include("../connect/connect.php");
$now = date("Y-m-d");
	if($_POST["list"]!="" && $_POST["amount"]!="" && $_POST["description"]!= "" )
		{
		$Query = "INSERT INTO expend (date,list,amount,description) VALUES ";
		$Query .="('$now','".$_POST["list"]."','".$_POST["amount"]."','".$_POST["description"]."' )";
		$objQuery = mysql_query($Query);

			if($objQuery) {
				$save="บันทึกข้อมูลเรียบร้อยแล้ว";
				} else {
				echo "Error Save [".$Query."]";
				}
		} else {
		$save="กรุณากรอกข้อมูลให้ครบ";
		}
}
?>
<form action="?action=add" name="formadd" method="post" id="formadd">
<div class="box">
  <div class="left"></div>
  <div class="right"></div>
    <div class="heading">
      <h1>บันทึกรายจ่าย</h1>
    <div class="buttons"><a onclick="formadd.submit();" class="button"><span>บันทึก</span></a><a onclick="location = 'product_manage.php';" class="button"><span>ยกเลิก</span></a></div></div>
  <div class="content">
    <table class="form">
      <tr>
        <td>รายการ : </td>
        <td><input type="text" name="list" id="list" onkeyup="IsScharacter(this.value,this)" /></td>
      </tr>
      <tr>
        <td>จำนวนเงิน : </td>
        <td><input type="text" name="amount" id="amount" onKeyUp="IsNumeric(this.value,this)" /></td>
      </tr>
      <tr>
        <td valign="top">รายละเอียด : </td>
        <td><textarea name="description" cols="40" rows="10" id="description" onkeyup="IsScharacter(this.value,this)"></textarea></td>
      </tr>
    </table>
	<?php echo "<br><font color=\"red\"><center>$save</center></font>"; ?>
  </div>
</div>
</form>
</body>
</html>
